// ShootSetPropertyPage.cpp : implementation file
//

#include "stdafx.h"
#include "configgui.h"
#include "global.h"
#include "TrainDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CShootSetPropertyPage property page

IMPLEMENT_DYNCREATE(CShootSetPropertyPage, CPropertyPage)

CShootSetPropertyPage::CShootSetPropertyPage()
	: CPropertyPage(CShootSetPropertyPage::IDD)
	, m_dSTDist(2000.0)
	, m_nMagRate(1)
{
	//{{AFX_DATA_INIT(CShootSetPropertyPage)
	//}}AFX_DATA_INIT
}

CShootSetPropertyPage::~CShootSetPropertyPage()
{
}

void CShootSetPropertyPage::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CShootSetPropertyPage)
	DDX_Text(pDX, IDE_STDIST, m_dSTDist);
	DDV_MinMaxDouble(pDX, m_dSTDist, 200., 5000.);
	DDX_Text(pDX, IDE_MAG, m_nMagRate);
	DDV_MinMaxUInt(pDX, m_nMagRate, 1, 5);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CShootSetPropertyPage, CPropertyPage)
	//{{AFX_MSG_MAP(CShootSetPropertyPage)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CShootSetPropertyPage message handlers

BOOL CShootSetPropertyPage::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 
{
	// TODO: Add your specialized code here and/or call the base class
	switch (((NMHDR*)lParam)->code) 
    {
    case PSN_SETACTIVE:
		break;
	case PSN_KILLACTIVE:
		return TRUE;
	}

	return CPropertyPage::OnNotify(wParam, lParam, pResult);
}

BOOL CShootSetPropertyPage::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	switch (pMsg->message)
	{
	case WM_KEYDOWN:
		if (VK_ESCAPE == pMsg->wParam)
			::SendMessage(GetPropSheet()->GetContainer()->GetSafeHwnd(),
							WM_KEYDOWN, pMsg->wParam, pMsg->lParam);
		else
			::TranslateMessage(pMsg);
		return TRUE;
	}

	return CPropertyPage::PreTranslateMessage(pMsg);
}

BOOL CShootSetPropertyPage::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	// TODO: Add your specialized code here and/or call the base class
	WORD wNotifyCode = HIWORD(wParam);
	
	if (EN_CHANGE == wNotifyCode)
	{
		SetModified();
	}

	return CPropertyPage::OnCommand(wParam, lParam);
}
